﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using _MetalSlug.Soldiers.Units;

namespace _MetalSlug.Soldiers.Factory
{
    public class SoldierStore
    {
        static SoldierStore Instance;
        List<Enemy> soliders;

        public List<Enemy> Soliders
        {
            get { return soliders; }
            set { soliders = value; }
        }

        protected SoldierStore()
        {
            Soliders = new List<Enemy>();
            Soliders.Add(new AKSoldier(Vector2.Zero,Vector2.Zero));
            Soliders.Add(new BazokaSoldier(Vector2.Zero, Vector2.Zero));
            Soliders.Add(new MiniGunSoldier(Vector2.Zero, Vector2.Zero));
            Soliders.Add(new Helicoper(Vector2.Zero,Vector2.Zero));
            Soliders.Add(new Tycoon(Vector2.Zero, new Vector2(240, 400)));
        }

        public static SoldierStore GetInstance()
        {
            if(Instance == null)
            {
                Instance = new SoldierStore();
            }
            return Instance;
        }

        public Enemy Produce(int Id, Enemy.TYPE_SOLDIER Type, Vector2 topleft)
        {
            return (from t in Soliders where t.Type == Type select t.Clone(Id,topleft)).FirstOrDefault();
        }
    }
}
